using System;
using System.Collections.Generic;
using System.Text;
using BusinessObjects.BO_Actions.Services;
using Entity.StoreProcedure;
using BusinessObjects;
using System.Data;
using BusinessObjects.BO_Actions.Articles;
namespace BusinessObjects.BO_GetObjects
{
    public static class BO_Services
    {
        public static DataTable SelectAll(int status)
        {
            try
            {
                BOServices_Select_All action = new BOServices_Select_All();
                usp_Services_Select_All entity = new usp_Services_Select_All();
                entity.STATUS = status;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectTop(int rows, int status)
        {
            try
            {
                BOServices_Select_Top action = new BOServices_Select_Top();
                usp_Services_Select_Top entity = new usp_Services_Select_Top();
                entity.NUMBERRECORD = rows;
                entity.STATUS = status;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable Search(int service_id)
        {
            try
            {
                BOServices_Search action = new BOServices_Search();
                usp_Services_Search entity = new usp_Services_Search();
                entity.SERVICE_ID = service_id;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectWithPaged(int startIndex, int pageCount, int status)
        {
            try
            {
                BOServices_Select_WithPaged action = new BOServices_Select_WithPaged();
                usp_Services_Select_WithPaged entity = new usp_Services_Select_WithPaged();
                entity.STARTINDEX = startIndex;
                entity.MAXRECORDS = pageCount;
                entity.STATUS = status;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static string Insert(int category_id, string module_id, string service_code, string thumb_img, string file_attach_link, string short_service_title, string short_service_title_eng, string full_service_title, string full_service_title_eng, string short_service_description, string short_service_description_eng, string full_service_description, string full_service_description_eng, string service_detail, string service_detail_eng, string meta_keyword, string meta_description, int total_comment, int total_view, bool is_display_on_home_page, bool is_free, bool is_personal, DateTime created_date, string created_by, DateTime modify_date, string modify_by, int status)
        {
            try
            {
                BOServices_Insert action = new BOServices_Insert();
                usp_Services_Insert entity = new usp_Services_Insert();
                entity.CATEGORY_ID = category_id;
                entity.MODULE_ID = module_id;
                entity.SERVICE_CODE = service_code;
                entity.THUMB_IMG = thumb_img;
                entity.FILE_ATTACH_LINK = file_attach_link;
                entity.SHORT_SERVICE_TITLE = short_service_title;
                entity.SHORT_SERVICE_TITLE_ENG = short_service_title_eng;
                entity.FULL_SERVICE_TITLE = full_service_title;
                entity.FULL_SERVICE_TITLE_ENG = full_service_title_eng;
                entity.SHORT_SERVICE_DESCRIPTION = short_service_description;
                entity.SHORT_SERVICE_DESCRIPTION_ENG = short_service_description_eng;
                entity.FULL_SERVICE_DESCRIPTION = full_service_description;
                entity.FULL_SERVICE_DESCRIPTION_ENG = full_service_description_eng;
                entity.SERVICE_DETAIL = service_detail;
                entity.SERVICE_DETAIL_ENG = service_detail_eng;
                entity.META_KEYWORD = meta_keyword;
                entity.META_DESCRIPTION = meta_description;
                entity.TOTAL_COMMENT = total_comment;
                entity.TOTAL_VIEW = total_view;
                entity.IS_DISPLAY_ON_HOME_PAGE = is_display_on_home_page;
                entity.IS_FREE = is_free;
                entity.IS_PERSONAL = is_personal;
                entity.CREATED_DATE = created_date;
                entity.CREATED_BY = created_by;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.STATUS = status;
                return action.ExecuteAndReturnStringValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static string Update(Int64 service_id, int category_id, string module_id, string service_code, string thumb_img, string file_attach_link, string short_service_title, string short_service_title_eng, string full_service_title, string full_service_title_eng, string short_service_description, string short_service_description_eng, string full_service_description, string full_service_description_eng, string service_detail, string service_detail_eng, string meta_keyword, string meta_description, int total_comment, int total_view, bool is_display_on_home_page, bool is_free, bool is_personal, DateTime created_date, string created_by, DateTime modify_date, string modify_by, int status)
        {
            try
            {
                BOServices_Update action = new BOServices_Update();
                usp_Services_Update entity = new usp_Services_Update();
                entity.SERVICE_ID = service_id;
                entity.CATEGORY_ID = category_id;
                entity.MODULE_ID = module_id;
                entity.SERVICE_CODE = service_code;
                entity.THUMB_IMG = thumb_img;
                entity.FILE_ATTACH_LINK = file_attach_link;
                entity.SHORT_SERVICE_TITLE = short_service_title;
                entity.SHORT_SERVICE_TITLE_ENG = short_service_title_eng;
                entity.FULL_SERVICE_TITLE = full_service_title;
                entity.FULL_SERVICE_TITLE_ENG = full_service_title_eng;
                entity.SHORT_SERVICE_DESCRIPTION = short_service_description;
                entity.SHORT_SERVICE_DESCRIPTION_ENG = short_service_description_eng;
                entity.FULL_SERVICE_DESCRIPTION = full_service_description;
                entity.FULL_SERVICE_DESCRIPTION_ENG = full_service_description_eng;
                entity.SERVICE_DETAIL = service_detail;
                entity.SERVICE_DETAIL_ENG = service_detail_eng;
                entity.META_KEYWORD = meta_keyword;
                entity.META_DESCRIPTION = meta_description;
                entity.TOTAL_COMMENT = total_comment;
                entity.TOTAL_VIEW = total_view;
                entity.IS_DISPLAY_ON_HOME_PAGE = is_display_on_home_page;
                entity.IS_FREE = is_free;
                entity.IS_PERSONAL = is_personal;
                entity.CREATED_DATE = created_date;
                entity.CREATED_BY = created_by;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.STATUS = status;
                return action.ExecuteAndReturnStringValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Delete(int service_id)
        {
            try
            {
                BOServices_Delete action = new BOServices_Delete();
                usp_Services_Delete entity = new usp_Services_Delete();
                entity.SERVICE_ID = service_id;
                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Restore(int service_id)
        {
            try
            {
                BOServices_Restore action = new BOServices_Restore();
                usp_Services_Restore entity = new usp_Services_Restore();
                entity.SERVICE_ID = service_id;
                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectAdmin(string keyword, int module_id, int category_id, int startIndex, int pageCount)
        {
            try
            {
                BOServices_Select_Admin action = new BOServices_Select_Admin();
                usp_Services_Select_Admin entity = new usp_Services_Select_Admin();
                entity.STARTINDEX = startIndex;
                entity.MAXRECORDS = pageCount;
                entity.KEYWORD = keyword;
                entity.MODULE_ID = module_id;
                entity.CATEGORY_ID = category_id;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectByModule(int status, int startindex, int maxrecord, int module_id)
        {
            try
            {
                BOServices_Select_By_Module action = new BOServices_Select_By_Module();
                usp_Services_Select_By_Module entity = new usp_Services_Select_By_Module();
                entity.MAXRECORDS = maxrecord;
                entity.MODULE_ID = module_id;
                entity.STARTINDEX = startindex;
                entity.STATUS = status;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectByCategory(int category_id, int start, int maxrecord)
        {
            try
            {
                BOServices_Select_By_Category action = new BOServices_Select_By_Category();
                usp_Services_Select_By_Category entity = new usp_Services_Select_By_Category();
                entity.CATEGORY_ID = category_id;
                entity.STARTINDEX = start;
                entity.MAXRECORDS = maxrecord;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectByType(bool is_personal, int start, int maxrecord)
        {
            try
            {
                BOServices_Select_By_Type action = new BOServices_Select_By_Type();
                usp_Services_Select_By_Type entity = new usp_Services_Select_By_Type();
                entity.IS_PERSONAL = is_personal;
                entity.STARTINDEX = start;
                entity.MAXRECORDS = maxrecord;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}

